package com.example.mobile2121606110syc0409homework;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity7 extends AppCompatActivity {

    private TextView tvMainTitle7;
    private TextView tvMainTit71;
    private TextView tvMainTit72;
    private TextView tvMainTit73;
    private EditText edtTtPN7;
    private Button btnMain7;
    private TextView tvMainTit74;
    private TextView tvMainTit75;
    private TextView tvMainTit76;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main7);
        initView();
        btnMain7.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String num = edtTtPN7.getText().toString();
                tvMainTit74.setText(String.valueOf(num.length()));
                char[] chars = num.toCharArray();
                tvMainTit75.setText(String.valueOf(chars));
                StringBuffer sb=new StringBuffer(num);
                tvMainTit76.setText(sb.reverse());
            }
        });
    }

    private void initView() {
        tvMainTitle7 = (TextView) findViewById(R.id.tvMainTitle7);
        tvMainTit71 = (TextView) findViewById(R.id.tvMainTit71);
        tvMainTit72 = (TextView) findViewById(R.id.tvMainTit72);
        tvMainTit73 = (TextView) findViewById(R.id.tvMainTit73);
        edtTtPN7 = (EditText) findViewById(R.id.edtTtPN7);
        btnMain7 = (Button) findViewById(R.id.btnMain7);
        tvMainTit74 = (TextView) findViewById(R.id.tvMainTit74);
        tvMainTit75 = (TextView) findViewById(R.id.tvMainTit75);
        tvMainTit76 = (TextView) findViewById(R.id.tvMainTit76);
    }
}